const PAGE_PREVIEW_ANIMATION_TIME = 150;
const PAGE_PREVIEW_ANIMATION_START_OFFSET = 100;
-const PAGE_PREVIEW_FADE_EFFECT_MAX_OFFSET = 300;
const PAGE_PREVIEW_MAX_ARROW_OFFSET = 80;
const PAGE_INDICATOR_FADE_TIME = 200;
this._swipeTracker.connect('update', this._swipeUpdate.bind(this));
this._swipeTracker.connect('end', this._swipeEnd.bind(this));
- this._availWidth = 0;
- this._availHeight = 0;
this._orientation = Clutter.Orientation.HORIZONTAL;
this._items = new Map();
this._disconnectDnD();
}
- _updateFadeForNavigation() {
- const fadeMargin = new Clutter.Margin();
- const rtl = this.get_text_direction() === Clutter.TextDirection.RTL;
- const showingNextPage = this._pagesShown & SidePages.NEXT;
- const showingPrevPage = this._pagesShown & SidePages.PREVIOUS;
-
- if ((showingNextPage && !rtl) || (showingPrevPage && rtl)) {
- fadeMargin.right = Math.max(
- -PAGE_PREVIEW_FADE_EFFECT_MAX_OFFSET,
- -(this._availWidth - this._grid.layout_manager.pageWidth) / 2);
- }
-
- if ((showingPrevPage && !rtl) || (showingNextPage && rtl)) {
- fadeMargin.left = Math.max(
- -PAGE_PREVIEW_FADE_EFFECT_MAX_OFFSET,
- -(this._availWidth - this._grid.layout_manager.pageWidth) / 2);
- }
-
- this._scrollView.update_fade_effect(fadeMargin);
- const effect = this._scrollView.get_effect('fade');
- if (effect)
- effect.extend_fade_area = true;
- }
-
_createGrid() {
return new IconGrid.IconGrid({ allow_incomplete_pages: true });
}
const leftPadding = Math.floor(
(availWidth - this._grid.layout_manager.pageWidth) / 2);
-
- this._availWidth = availWidth;
- this._availHeight = availHeight;
-
this._pageIndicatorOffset = leftPadding;
this._pageArrowOffset = Math.max(
leftPadding - PAGE_PREVIEW_MAX_ARROW_OFFSET, 0);
duration: PAGE_PREVIEW_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
});
- this._updateFadeForNavigation();
} else if (adjustment) {
adjustment.ease(0, {
duration: PAGE_PREVIEW_ANIMATION_TIME,
this._syncClip();
this._nextPageArrow.visible = false;
this._nextPageIndicator.visible = false;
- this._updateFadeForNavigation();
},
});
}
duration: PAGE_PREVIEW_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
});
- this._updateFadeForNavigation();
} else if (adjustment) {
adjustment.ease(0, {
duration: PAGE_PREVIEW_ANIMATION_TIME,
this._syncClip();
this._prevPageArrow.visible = false;
this._prevPageIndicator.visible = false;
- this._updateFadeForNavigation();
},
});
}